package com.evildog.workspace.file.config;

import com.evildog.workspace.file.upload.decorator.DbFileUploadDecorator;
import com.evildog.workspace.file.upload.properties.FileNginxProperties;
import com.evildog.workspace.file.upload.uploader.FileUploader;
import com.evildog.workspace.file.upload.uploader.LocalFileUploader;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FileUploadConfig {

    @Bean(name = "LocalFileUploader")
    public FileUploader fileUploader(FileNginxProperties fileNginxProperties) {
        return new LocalFileUploader(fileNginxProperties);
    }

    @Bean
    public DbFileUploadDecorator dbFileUploadDecorator(FileUploader fileUploader) {
        return new DbFileUploadDecorator(fileUploader);
    }
}
